split string every n characters python

35

python convert strings to chunks -

s = '1234567890'
o = []
while s:
    o.append(s[:2])
    s = s[2:]

Comments

Submit
0 Comments